import numpy as np
print(np.__version__)

a = 5
print(type(a))

int_list = list(range(10))
print(int_list)  #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

str_list = [str(i) for i in int_list]
print(str_list)  #['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

str_list2 = str(int_list)
print(str_list2)  #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], str对list无效果

int_arr = np.array(int_list)
print(int_arr)  # [0 1 2 3 4 5 6 7 8 9]  表现形式和list不用，list中间是有","的
print(2*int_list) #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print(2*int_arr) #[ 0  2  4  6  8 10 12 14 16 18]

print("int_arr_ndim", int_arr.ndim)  #int_arr_ndim 1
print("int_arr_shape",int_arr.shape)  #int_arr_shape (10,)
print("int_arr_dtype", int_arr.dtype)  #int_arr_dtype int32

print(int_arr[1])  #1
print(int_arr[3])  #3
print(int_arr[-1])  #9
print(int_arr[-3]) #7

print(int_arr[2:5])   #[2 3 4]
print(int_arr[:5])   #[0 1 2 3 4]
print(int_arr[5:])   #[5 6 7 8 9]
print(int_arr[::2])  #[0 2 4 6 8]
print(int_arr[::-1])  #[9 8 7 6 5 4 3 2 1 0]

arr_2d = np.zeros((3,5))   #3行 5列的数组
print(arr_2d)
print(type(arr_2d))   #<class 'numpy.ndarray'>

arr_float_3d = np.ones((3,2,4))
print(arr_float_3d)
'''
[[[1. 1. 1. 1.]
  [1. 1. 1. 1.]]

 [[1. 1. 1. 1.]
  [1. 1. 1. 1.]]

 [[1. 1. 1. 1.]
  [1. 1. 1. 1.]]]
'''

print(arr_float_3d[0,:,:])
'''
[[1. 1. 1. 1.]
 [1. 1. 1. 1.]]
'''


arr_uint_3d = np.ones((3,2,4),dtype = np.uint8)*255
print(arr_uint_3d)
'''
[[[255 255 255 255]
  [255 255 255 255]]

 [[255 255 255 255]
  [255 255 255 255]]

 [[255 255 255 255]
  [255 255 255 255]]]
'''
print(type(arr_uint_3d[1,1,1]))